package com.hcloud.uploadsdk;

import com.cloud.wolibrary.callback.UploadStrategy;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zlp on 2021/5/11 0011.
 */

public class MyUploadStrategy implements UploadStrategy {

    private List<File> filterUploadList = new ArrayList<>();
    private List<File> filterBackupList = new ArrayList<>();

    @Override
    public boolean beforeUpload(File file, int uploadType) {
        String name = file.getName();
        long size = file.length();
        if (name.endsWith(".avi") || name.endsWith(".mp4") || size>(1L*1024*1024*100)){
            //uploadType 0上传  1备份
            if (uploadType ==0){
                filterUploadList.add(file);
            }else {
                filterBackupList.add(file);
            }
            return false;
        }
        return true;
    }

    public List<File> getFilterUploadList() {
        return filterUploadList;
    }

    public List<File> getFilterBackupList() {
        return filterBackupList;
    }
}
